Document new source finding behaviour#9923
Merged
hauntsaninja merged 4 commits intopython:masterfrom Jan 19, 2021
Merged
Conversation
This should cover the current state on master, as previously discussed / implemented across python#9742, python#9683, python#9632, python#9616, python#9614, etc. This will need to be changed if we can make `--namespace-packages` the default (python#9636). I haven't documented some of the finer points of the changes, since it felt like an inappropriate level of detail (e.g. using absolute paths when crawling, how directories with invalid package names affect crawling, etc)
Closed
added 2 commits
January 18, 2021 11:35
JukkaL
approved these changes
Jan 19, 2021
Collaborator
JukkaL
left a comment
There was a problem hiding this comment.
Thanks for documenting this! Specifying the files to type check can be a little tricky, especially when namespace packages are used, so documenting it in detail is very useful.
Looks good, just a few minor comments.
docs/source/running_mypy.rst
Outdated
|
|
||
| - Files ending in ``.py`` (and stub files ending in ``.pyi``) are | ||
| checked as Python modules. | ||
| - mypy will check all paths provided that correspond to files. |
Collaborator
There was a problem hiding this comment.
Style nit: At the start of a sentence, capitalize 'mypy' (mypy -> Mypy).
docs/source/running_mypy.rst
Outdated
| checked as Python modules. | ||
| - mypy will check all paths provided that correspond to files. | ||
|
|
||
| - mypy will recursively discover and check all files ending in ``.py`` or |
docs/source/running_mypy.rst
Outdated
| - For each file to be checked, mypy will attempt to associate the file (e.g. | ||
| ``project/foo/bar/baz.py``) with a fully qualified module name (e.g. | ||
| ``foo.bar.baz``). The directory the package is in (``project``) is then | ||
| add to mypy's module search paths. |
| With :option:`--explicit-package-bases <mypy --explicit-package-bases>`, mypy | ||
| will locate the nearest parent directory that is a member of the ``MYPYPATH`` | ||
| environment variable, the :confval:`mypy_path` config or is the current | ||
| working directory. mypy will then use the relative path to determine the |
Collaborator
There was a problem hiding this comment.
Should you also mention module search path items from PEP 561 packages?
Collaborator
Author
There was a problem hiding this comment.
No (although maybe I misunderstood the question), there isn't an interaction with PEP 561 packages when you pass files:
Line 73 in 9c54cc3
ilevkivskyi
pushed a commit
that referenced
this pull request
Jan 20, 2021
This should cover the current state on master, as previously discussed / implemented across #9742, #9683, #9632, #9616, #9614, etc. This will need to be changed if we can make `--namespace-packages` the default (#9636). I haven't documented some of the finer points of the changes, since it felt like an inappropriate level of detail (e.g. using absolute paths when crawling, how directories with invalid package names affect crawling, etc) Co-authored-by: hauntsaninja <>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This should cover the current state on master, as previously
discussed / implemented across #9742, #9683, #9632, #9616, #9614, etc.
This will need to be changed if we can make
--namespace-packagesthedefault (#9636).
I haven't documented some of the finer points of the changes, since it
felt like an inappropriate level of detail (e.g. using absolute paths
when crawling, how directories with invalid package names affect
crawling, etc)